From: Jo-Philipp Wich Date: Sat, 4 Feb 2023 21:15:42 +0000 (+0100) Subject: luci-base: form.js: reuse JSONMap data provider in GridSection modals X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=790b738ddad6cdc54e897ab7b89208e15394b489;p=project%2Fluci.git luci-base: form.js: reuse JSONMap data provider in GridSection modals Reuse the same data provider as the parent JSONMap instance in order to avoid inadvertently mangling the form data when saving the modal edit dialog. Fixes: bb9ede238a ("luci-base: form.js: reuse JSONMap data provider in GridSection modals") Signed-off-by: Jo-Philipp Wich (cherry picked from commit dd47f3f6742a6d80221b75aa7b6ea27eca2bb535) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 5e31dc0dbe..103173e1c8 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -3213,10 +3213,13 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p var m; - if (parent instanceof CBIJSONMap) - m = new CBIJSONMap(parent.data.data, null, null); - else + if (parent instanceof CBIJSONMap) { + m = new CBIJSONMap(null, null, null); + m.data = parent.data; + } + else { m = new CBIMap(parent.config, null, null); + } var s = m.section(CBINamedSection, section_id, this.sectiontype);